<%--
  Created by IntelliJ IDEA.
  User: koun
  Date: 2020/12/2
  Time: 15:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>登录页面</title>
    <link rel="stylesheet" href="../layui/css/layui.css"/>
    <style type="text/css">
        #login{
            height: 500px;
            width: 500px;
            box-shadow: 0 0  5px 5px pink;
            border-radius: 10px;
            padding: 10px;
            box-sizing: border-box;
        }
        body{
            margin:  0px;
            padding: 0px;
            display: flex;
            min-height: 100vh;
            justify-content: center;
            align-items: center;
        }
        #login img{
            width: 100%;
        }
        #login h1{
            text-align: center;
            color: #009688;
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
<div id="login">
    <img src="../images/logo-2.png">
    <h1>请登录</h1>
    <form class="layui-form layui-form-pane" action="">
        <div class="layui-form-item" pane>
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="username" required  lay-verify="checkUserName" placeholder="请输入账号" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" pane>
            <label class="layui-form-label">密码</label>
            <div class="layui-input-block">
                <input type="password" name="password" required  lay-verify="checkPassword" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">验证码</label>
            <div class="layui-input-block">
                <input type="password" name="验证码" required  lay-verify="checkVerify" placeholder="请输入密码" autocomplete="off" class="layui-input layui-input-inline">
                <img id="verifyCode" src="../views/images/logo-2.png" style="height: 42px;width: 100px">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>


<script src="../layui/layui.all.js"></script>
<script>
    (function () {
        var form = layui.form;
        form.verify({
            checkUserName:function (value) {
                if(value.length < 5){
                    return "用户名不等小于5位";
                }
            },
            checkPassword:function (value) {
                if (value.length < 5) {
                    return "密码不等小于5位";
                }
            },
            checkVerity:function (value) {
                if(value.length== 0){
                    return "验证码不能为空";
                }
            }
        });
    })();
</script>
</body>
</html>
